﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PMS.Utilities
{
    public static class DecimalExtensions
    {
        public static string ToFormatString(this Decimal? de)
        {
            if (!de.HasValue) { return String.Empty; }
            return de.Value.ToFormatString();
        }

        public static string ToFormatString(this Decimal de)
        {
            if (de == 0) { return String.Empty; }
            string result =String.Format(Utility.cultureInfo, "{0:C}", de);
            return result;
        }

        public static string ToNumberString(this Decimal? de)
        {
            if (!de.HasValue) { return String.Empty; }
            return de.Value.ToNumberString();
        }

        public static string ToNumberString(this Decimal de)
        {
            if (de == 0) { return String.Empty; }
            string result = String.Format(Utility.cultureInfo, "{0:N}", de);
            return result;
        }
    }
}
